home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / bascde12.zip / BASCODE.LIB < prev    next >
Text File  |  1994-02-21  |  4KB  |  111 lines

  1. BASCODEV1***
  2. LIBRARYNAME : BASCODE 
  3. DESCRIPTION : BasCode Shareware Library
  4. ))))))))))))))))))))))))))))))))))))))
  5. CODETITLE : To Shell To Dos
  6. DESCRIPTION : Function to shell to Dos/Other App and stay in function until finished. Returns ID/Error Code.
  7. DATESTORED : 01-20-1994
  8. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  9. Function ToShellToDos (commandline As String) As Long
  10. Rem ** API to discover if a program is executing By M.Brewerton 1993**
  11. Rem ** Declare Function GetModuleUsage% Lib "Kernel" (ByVal hProgram%) **
  12. Rem ** Routine To Shell To Dos And Stay In This Routine Until Task Is Complete **
  13.   s% = Shell(commandline$)        'shells out with the command in commandline$
  14.     While GetModuleUsage(s%)      'checks to see if finished
  15.       x% = DoEvents()                     'allows it to continue if unfinished.
  16.     Wend
  17.   ToShellToDos = s%               'returns task ID or error code from function.
  18. End Function
  19. ((((((((((((((((((((((((((((((((((((((
  20. ))))))))))))))))))))))))))))))))))))))
  21. CODETITLE : Check For Another
  22. DESCRIPTION : Will Check To See If Program Is Running.
  23. DATESTORED : 01-20-1994
  24. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  25. Function CheckInstance (fi As String) As Long
  26. Rem ** Check to see if program already executing **
  27. Rem ** Include The Following API **
  28. Rem ** Declare Function GetModuleHandle% Lib "Kernel" (ByVal lpProgramName$) **
  29. Rem ** Declare Function GetModuleUsage% Lib "Kernel" (ByVal hProgram%) **
  30.   hw% = GetModuleHandle(fi$)
  31.   CheckInstance = GetModuleUsage(hw%)
  32. Rem ** Returns a value of greater than 1 if fi$ loaded **
  33. End Function
  34. ((((((((((((((((((((((((((((((((((((((
  35. ))))))))))))))))))))))))))))))))))))))
  36. CODETITLE : Centre Your Form
  37. DESCRIPTION : Gets Screen/Form Limits And Then Places Form In Centre.
  38. DATESTORED : 01-20-1994
  39. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  40. Sub Centreform (Form As Form)
  41. Rem ** routine that centres the form control on the screen control **
  42. Rem ** M.Brewerton 1993 **
  43.   sh = screen.Height
  44.   sw = screen.Width
  45.   fw = Form.Width
  46.   fh = Form.Height
  47.   Form.Top = (sh / 2) - (fh / 2)
  48.   Form.Left = (sw / 2) - (fw / 2)
  49. End Sub
  50. ((((((((((((((((((((((((((((((((((((((
  51. ))))))))))))))))))))))))))))))))))))))
  52. CODETITLE : Get StartUp Directory
  53. DESCRIPTION : Function that will return the startup directory of a given program e.g. "BASCODE.EXE"
  54. DATESTORED : 01-20-1994
  55. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  56. Function Startup (fi As String) As String
  57. Rem ** API to check for Startup Directory, Place In Module **
  58. Rem ** Declare Function GetModuleFileName% Lib "kernel" (ByVal hModule%, ByVal FileName$,
  59. ByVal nSize%) **
  60. Rem ** Finds and returns the startup directory of fi$ **
  61. Rem ** Presuming that it is running at the present time. **
  62.   hModule% = GetModuleHandle(fi$)
  63.   buffer$ = Space$(255)
  64.   Length% = GetModuleFileName(hModule%, buffer$, Len(buffer$))
  65.   buffer$ = Left$(buffer$, Length%)
  66.   Startup = buffer$
  67. End Function
  68. ((((((((((((((((((((((((((((((((((((((
  69. ))))))))))))))))))))))))))))))))))))))
  70. CODETITLE : Restart Windows
  71. DESCRIPTION : How to Use API to Ask Windows To Restart
  72. DATESTORED : 01-21-1994
  73. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  74. REM ** How To Restart Windows **
  75. REM ** Place API below in MODULE **
  76. REM ** (Paul Smith) **
  77. Declare Function ExitWindows% Lib "User" (ByVal dwReserved&, ByVal wReturnCode%)
  78. x% = ExitWindows(66, 66)
  79. ((((((((((((((((((((((((((((((((((((((
  80. ))))))))))))))))))))))))))))))))))))))
  81. CODETITLE : Search List By API
  82. DESCRIPTION : Search through a List for a text string using API (Don Funk, API)
  83. DATESTORED : 01-20-1994
  84. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  85. REM ** Code Segment By Don Funk, MS **
  86. REM ** Searches LIST for Occurrance Of Text **
  87. REM ** Place Following API is Module **
  88. Declare Function SendMessage& Lib "user" (ByVal hWnd%, ByVal wMsg%,ByVal wParam%,ByVal lParam As String)
  89. Declare Function Getfocus% Lib "user" ()
  90. Dim ListHwnd As Integer
  91.  
  92. Sub Form_Click ()
  93.    List1.AddItem "John":List1.AddItem "George":List1.AddItem "Sue"
  94. End Sub
  95.  
  96. Sub Text1_Change ()
  97.    Const LB_SELECTSTRING = &H400 + 13
  98.    Static X As Long
  99.    wParam = 1
  100.    lParam$ = Text1.Text + Chr$(0)
  101.    X = SendMessage(ListHwnd, LB_SELECTSTRING, wParam, lParam$)
  102.    Print X
  103. End Sub
  104.  
  105. Sub Form_Load ()
  106.    Form1.Show
  107.    List1.SetFocus
  108.    ListHwnd = Getfocus()
  109. End Sub
  110. ((((((((((((((((((((((((((((((((((((((
  111.